package com.sjb.cp.model.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;

/**
 * @Author:sjb
 * @CreateTime:2025-01-20
 * @Description: 图片审核枚举类
 * @Version：1.0
 */
@Getter
public enum PictureReviewStatusEnum {


    REVIEWING("待审核",0),
    PASS("审核通过",1),
    REJECT("审核拒绝",2);

    private final int code;
    private final String msg;

    PictureReviewStatusEnum(String msg, int code) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 根据code获取枚举值
     * @param code
     * @return
     */
    public static PictureReviewStatusEnum getEnumMsgByCode(int code) {
        if (ObjectUtil.isEmpty(code)){
            return null;
        }

        for (PictureReviewStatusEnum pictureReviewStatusEnum : PictureReviewStatusEnum.values()) {
            if (pictureReviewStatusEnum.getCode() == code){
                return pictureReviewStatusEnum;
            }
        }
        return null;
    }
}
